package com.weetop.cfw.home_page.activity

import android.os.Bundle
import android.view.View
import com.blankj.utilcode.util.ActivityUtils
import com.weetop.cfw.R
import com.weetop.cfw.base.presenter.imp.EnterpriseServicePresenterImp
import com.weetop.cfw.base.ui.activity.CommonBaseActivity
import com.weetop.cfw.base.view.EnterpriseServiceView
import com.weetop.cfw.bean.SinglePageIntroduceBean
import kotlinx.android.synthetic.main.activity_enterprise_service.*

/**
 * 企业服务界面
 */
class EnterpriseServiceActivity : CommonBaseActivity(),View.OnClickListener,EnterpriseServiceView {

    private lateinit var enterpriseServicePresenterImp: EnterpriseServicePresenterImp

    override fun onClick(p0: View?) {
        when(p0?.id){
            R.id.imageEnterpriseServiceBack -> ActivityUtils.finishActivity(this)
        }
    }

    companion object{
        const val ENTERPRISE_SERVICE_TYPE = "EnterpriseServiceType"
    }

    override fun getLayoutId() = R.layout.activity_enterprise_service

    override fun initView(savedInstanceState: Bundle?) {
        setViewsOnClickListener(this,imageEnterpriseServiceBack)
    }

    override fun initData(savedInstanceState: Bundle?) {
        when (intent.getIntExtra(ENTERPRISE_SERVICE_TYPE,0)) {
            0 -> {
                textEnterpriseServiceTitle.text = "上市服务"
            }
            1 -> {
                textEnterpriseServiceTitle.text = "融资服务"
            }
            2 -> {
                textEnterpriseServiceTitle.text = "工商财税"
            }
        }

        enterpriseServicePresenterImp = EnterpriseServicePresenterImp()
        enterpriseServicePresenterImp.attachView(this)

        enterpriseServicePresenterImp.getListingServiceData(this)
    }

    override fun onDestroy() {
        super.onDestroy()
        enterpriseServicePresenterImp.detachView()
    }

    /**
     * 上市服务富文本获取成功
     */
    override fun listingServiceDataGetSuccess(singlePageIntroduceBean: SinglePageIntroduceBean?) {

    }

}
